package org.grow.enter.filter;

import org.springframework.stereotype.Service;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @Author: xwg
 * @CreateDate: 2021/9/8
 */

@Service
public class Second implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) servletRequest;
//        http://localhost:8080/aaa/vvv
//        request.getRequestURL();
//        /aaa/vvv
        String requestURI = request.getRequestURI();
        System.out.println("第二过滤器拦截到："+requestURI);
        filterChain.doFilter(servletRequest, servletResponse);
        System.out.println("第二过滤器结束");
    }
}
